cmake_minimum_required(VERSION 3.6)
project(hyperlpr)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
find_package(OpenCV CONFIG REQUIRED)

include_directories( ${OpenCV_INCLUDE_DIRS})
include_directories(include)

file(GLOB_RECURSE all_srcs ./src/*.cpp)

add_library(hyperlpr SHARED ${all_srcs})

target_link_libraries(hyperlpr ${OpenCV_LIBS})

if (PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
    file(GLOB test_sources test/*.cpp)
    foreach(path ${test_sources})
        get_filename_component(name ${path} NAME_WE)
        add_executable(${name} ${path})
        target_link_libraries(${name} PRIVATE hyperlpr)
    endforeach()
endif()